import request from '@/axios'
import type {
  RecommendProductListResponse,
  RecommendProductForm,
  DeleteParams,
  SelectedProductsResponse
} from './types'

// 获取推荐商品列表
export const getListApi = (params: any) => {
  return request.get<RecommendProductListResponse>({
    url: '/admin/recommendProduct',
    params
  })
}

export const getEnumApi = (params?: any) => {
  return request.get({ url: '/admin/recommendProduct/fieldEnum', params })
}

// 新增推荐商品
export const addApi = (data: RecommendProductForm) => {
  return request.post({
    url: '/admin/recommendProduct',
    data
  })
}

// 删除推荐商品
export const deleteApi = (data: DeleteParams) => {
  return request.delete({
    url: '/admin/recommendProduct',
    data
  })
}

export const getSelectedApi = (params: { position: number }) => {
  return request.get<SelectedProductsResponse>({
    url: '/admin/recommendProduct/selected',
    params
  })
}
